package thoven.achievement.net.ideapluginachievement.util

import com.intellij.util.xmlb.Converter
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

/**
 * LocalDateTime的序列化转换器
 */
class LocalDateTimeConverter : Converter<LocalDateTime>() {
    
    companion object {
        private val FORMATTER = DateTimeFormatter.ISO_LOCAL_DATE_TIME
    }
    
    override fun toString(value: LocalDateTime): String {
        return FORMATTER.format(value)
    }
    
    override fun fromString(value: String): LocalDateTime {
        return LocalDateTime.parse(value, FORMATTER)
    }
}

